package admincow.servlet.vaca;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import admincow.dao.VacaDAO;
import admincow.vo.VacaVO;

 public class VacaModificarServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
   static final long serialVersionUID = 1L;
   
    public VacaModificarServlet() {
		super();
	
	
	}   	
	
	/* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	
	
	
	}  	
	
	
	protected void doPost(HttpServletRequest request, 
			HttpServletResponse response) throws ServletException, IOException {
		
		System.out.println("dentro de modificar baquita");
		String a = request.getParameter("RPvaca");
		String b = request.getParameter("Idraza");
		String c = request.getParameter("nombre");
		String d = request.getParameter("fech_nac");
		String e = request.getParameter("registro");
		String f = request.getParameter("fech_reg");
		String g = request.getParameter("RPpadre");
		String h = request.getParameter("RPmadre");
		String i = request.getParameter("etapa");
		String j = request.getParameter("estado");
		String k = request.getParameter("ordenio");

		VacaVO vo = new VacaVO();
			vo.setRPvaca(a);
			vo.setIdraza(Integer.parseInt(b));
			vo.setNombre(c);
			vo.setFech_nac(d);
			vo.setRegistro(Integer.parseInt(e));
			vo.setFech_reg(f);
			vo.setRPpadre(g);
			vo.setRPmadre(h);
			vo.setEtapa(i);
			vo.setEstado(j);
			vo.setOrdenio(k);

		VacaDAO dao = new VacaDAO();
		dao.actualizar(vo);

		RequestDispatcher rd = request
				.getRequestDispatcher("/vacaBuscar.jsp");
		rd.forward(request, response);
	}   	  	    
}